home *** CD-ROM | disk | FTP | other *** search
/ PLAYymate for OS/2 / Playmate for OS2.iso / p4os2040 / maze.doc < prev    next >
Text File  |  1989-02-20  |  2KB  |  33 lines

  1.          This may aid your understanding of PMMAZE.  Unfortunately, use
  2. of an explicit stack instead of recursion results in somewhat obscure
  3. code.  Good luck!
  4.  
  5.                To create a maze, use walls to divide a pile of
  6.           clay into rectangular rooms of equal size.  Enter
  7.           the some room and remove the clay from it.  Randomly
  8.           pick an adjacent room that still has clay in it.  If
  9.           no such room exists, return to the room emptied just
  10.           before the current room was emptied and try again.
  11.           If you find an adjacent room containing clay, knock
  12.           down the wall separating you from it, enter it, and
  13.           remove the clay from it. Keep doing this until you
  14.           have returned to the first room to have been emptied
  15.           and can find no adjacent room containing clay.
  16.           Knock down the walls blocking the entrance and exit
  17.           to the maze; the maze is complete!
  18.  
  19.                To solve a maze, start at the entrance (lower
  20.           left-hand room).  Use chalk to draw a line on the
  21.           floor from the middle of the room to the outside of
  22.           the maze.  In a given room, find a direction out of
  23.           the room that you have not yet taken and that does
  24.           not follow your chalk line.  If such a direction
  25.           exists, extend the chalk line in that direction
  26.           until you reach the middle of an adjacent room.  If
  27.           no such direction exists, follow the chalk line out
  28.           of the room, erasing it until you reach the middle
  29.           of an adjacent room.  Since the maze generated by
  30.           this program has exactly one solution that does not
  31.           involve backtracking, you will eventually reach the
  32.           exit (upper right-hand room).
  33.